package br.com.utfpr.persistence;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public abstract class Conexao {
	//Abrir conexão
	protected Connection abreConexao () {
		Connection con = null;
		try {
			con = DriverManager.getConnection("jdbc:postgresql://localhost/postgres", "postgres", "postgres");
		} catch (SQLException e) {
			System.out.println("### ERRO ABERTURA DE CONEXAO: ");
			e.printStackTrace();
		}
		return con;
	}
	//fechar conexao
	protected void fechaConexao (Connection con) {
		try {
			if (con != null) {
				con.close();
			}
		} catch (SQLException e) {
			System.out.println("### ERRO FECHAR DE CONEXAO: ");
			e.printStackTrace();
		}
	}
	
}
